﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading.Tasks;

namespace SQL_EG.Tools
{
   public class Notification
    {
        public static void ThrowMessage(Exception ex)
        {
            MessageBox.Show(ex.Message, string.Format("Avertissement | {0} - {1}",
                             ConfigurationManager.AppSettings["versionName"],
                              ConfigurationManager.AppSettings["versionNumber"]), MessageBoxButtons.OK, MessageBoxIcon.Warning);
        }


        /// <summary>
        /// Cette méthode retourne un MessageBox avec le texte et l'icône appropriée
        /// </summary>
        public static void ThrowMessage(string Message)
        {
            MessageBox.Show(Message, string.Format("{0} - {1}",
                            ConfigurationManager.AppSettings["versionName"],
                             ConfigurationManager.AppSettings["versionNumber"]), MessageBoxButtons.OK, MessageBoxIcon.Information);
        }

        public static bool ThrowQuestion(string Message)
        {
            if (DialogResult.Yes == MessageBox.Show(Message, string.Format("Information | {0} - {1}",
                            ConfigurationManager.AppSettings["versionName"],
                             ConfigurationManager.AppSettings["versionNumber"]), MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                return true;
            else
                return false;
        }
    }
}
